<?
include dirname(__FILE__)."/../../global.php";


#if ($user["id"] && $_POST["content"]) {
if ($_POST["content"]) {
	$db->autoquery("insert","docscomment",array(
		"link"=>$_POST["link"],
		"datetimeon"=>date("Y-m-d H:i:s"),
		"users_id"=>$user["id"],
		"content"=>$_POST["content"],
		));
	header("Location: {$_POST["direct"]}?link={$_POST["link"]}#{$_POST["link"]}"); die;
	}

include dirname(__FILE__)."/css.php";
	
ob_start();	
$link = htmlentities($_REQUEST["link"]);

echo "<h1>$link</h1>";

echo "
<p>The user submitted comments should be used for:
<ul>
<li>Examples
<li>Helpful hints, tips, and tricks
<li>Further explanation / documentation
</ul>

<p>The user submitted comments should <b><u>NOT</u></b> be used for:
<ul>
<li>Bug Reports (see our new Bug Reports link on the side)
<li>Feature Requests
<li>Questions
</ul>";


echo "<p>Please note that periodically, the developers may go through the notes and incorporate the information in them into the documentation. This means that any note submitted here becomes the property of Pete Shinners under the LGPL licence.</p>";

#if (!$user["id"]) {
#echo "<p><b>If you wish to leave a comment, please <a href='$topurl/login/?direct=".urlencode($_SERVER["REQUEST_URI"])."'>sign in</a> first.</b></p>";
if (!$user["id"]) {
    echo "<p>If you do not want to leave an anonymous comment, please <a href='$topurl/login/?direct=".urlencode($_SERVER["REQUEST_URI"])."'>sign in</a> first.</b></p>";
    }
#} else {
    echo "<form method=post>";
    list($direct) = explode("?",$_SERVER["HTTP_REFERER"]);
    echo "<input type='hidden' name='direct' value='$direct'>";
    echo "<input type='hidden' name='link' value='$link'>";
    echo "<textarea name='content' rows=5 cols=80 WRAP=OFF></textarea><br>";
    echo "<input type='submit' value='Add Comment'>";
    echo "</form>";
#}

$content = ob_get_contents();
ob_end_clean();

$skin = "";
$ok = 1;
foreach (file("index.html") as $line) {
	if (stristr($line,"</body>")) $ok = 1;
	if ($ok) echo $line;
	if (stristr($line,"</table>")) { $ok = 0;
		echo $content;
		}
	}
?>
